//
//  headeItemrView.m
//  PrivatePodspec
//
//  Created by YDY on 2024/12/13.
//

#import "headeItemrView.h"

@interface headeItemrView ()

//@property (nonatomic,strong) UIStackView *stackView;
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UILabel *descLabel;


@end


@implementation headeItemrView

- (instancetype)init
{
    self = [super init];
    if (self) {
        
        [self setDistribution:UIStackViewDistributionFillEqually];
        [self setAxis:UILayoutConstraintAxisVertical];
        [self setSpacing:2];
        
     
//        [self addSubview:self.stackView];
//        [self.stackView addArrangedSubview:self.titleLabel];
//        [self.stackView addArrangedSubview:self.descLabel];
//        
        [self addArrangedSubview:self.titleLabel];
        [self addArrangedSubview:self.descLabel];
//        [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
//           
//            make.edges.equalTo(self).insets(UIEdgeInsetsMake(0, 0, 0, 0));
//        }];
        
    }
    return self;
}



- (void)setModel:(headerModel *)model {
    _model = model;
    
    [self.titleLabel setText:model.title];
    [self.descLabel setText:model.desc];
    
    for (NSString *one in model.itemArray) {
        
        UILabel *titleLabel = [[UILabel alloc]init];
        [titleLabel setFont:[UIFont systemFontOfSize:20]];
        [titleLabel setTextColor:UIColor.blackColor];
        [titleLabel setBackgroundColor:UIColor.blueColor];
        [titleLabel setText:one];
        [self addArrangedSubview:titleLabel];
    }
    
    
}


#pragma mark - lazy
//- (UIStackView *)stackView {
//    if (!_stackView) {
//        _stackView  = [[UIStackView alloc]init];
//        [_stackView setDistribution:UIStackViewDistributionFillEqually];
//        [_stackView setAxis:UILayoutConstraintAxisVertical];
//        [_stackView setSpacing:2];
//        [_stackView setBackgroundColor:UIColor.redColor];
//    }
//    return _stackView;
//}
//


-(UILabel *)titleLabel {
    if (!_titleLabel) {
        
        _titleLabel = [UILabel new];
        [_titleLabel setFont:[UIFont systemFontOfSize:20]];
        [_titleLabel setTextColor:UIColor.blackColor];
        [_titleLabel setBackgroundColor:UIColor.blueColor];
//        [_titleLabel setNumberOfLines:0];
        
    }
    return _titleLabel;
}


-(UILabel *)descLabel {
    if (!_descLabel) {
        
        _descLabel = [UILabel new];
        [_descLabel setFont:[UIFont systemFontOfSize:15]];
        [_descLabel setTextColor:UIColor.brownColor];
        [_titleLabel setBackgroundColor:UIColor.systemPinkColor];
//        [_descLabel setNumberOfLines:0];
    }
    return _descLabel;
}









@end

